<html><head><style>
	.KEYW {color: #933;}
	.COMM {color: #bbb; font-style: italic;}
	.NUMB {color: #393;}
	.STRN {color: #393;}
	.REGX {color: #339;}
	.linenumber {border-right: 1px dotted #666; color: #666; font-style: normal;}
	</style></head><body><pre><span class='linenumber'>  1</span> <span class="COMM">// Copyright 2008 Google Inc.  All Rights Reserved.</span><span class="WHIT">
<span class='linenumber'>  2</span> 
<span class='linenumber'>  3</span> </span><span class="COMM">/**
<span class='linenumber'>  4</span>  * @fileoverview A wrapper for opensocial javascript API into actionscript.
<span class='linenumber'>  5</span>  * &lt;p>
<span class='linenumber'>  6</span>  * It works with the Opensocial Flash API.
<span class='linenumber'>  7</span>  * In this file, the local var with underscore indicates that this obj is
<span class='linenumber'>  8</span>  * a JSON object wappered from opensocial data types.
<span class='linenumber'>  9</span>  * &lt;/p>
<span class='linenumber'> 10</span>  * 
<span class='linenumber'> 13</span>  * @see http://code.google.com/apis/opensocial/docs/0.7/reference/
<span class='linenumber'> 14</span>  *
<span class='linenumber'> 15</span>  * @version 0.7
<span class='linenumber'> 16</span>  * @author yiziwu@google.com (Yizi Wu)
<span class='linenumber'> 17</span>  */</span><span class="WHIT">
<span class='linenumber'> 18</span> 
<span class='linenumber'> 19</span> </span><span class="COMM">//======================== FLAGS and Constants =================================</span><span class="WHIT">
<span class='linenumber'> 20</span> </span><span class="COMM">/** 
<span class='linenumber'> 21</span>  * Flag for JSCompiler.
<span class='linenumber'> 22</span>  * @type {boolean}
<span class='linenumber'> 23</span>  * @private
<span class='linenumber'> 24</span>  */</span><span class="WHIT">
<span class='linenumber'> 25</span> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">COMPILED</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'> 26</span> 
<span class='linenumber'> 27</span> </span><span class="COMM">/** 
<span class='linenumber'> 28</span>  * Set to false for release. 
<span class='linenumber'> 29</span>  * @type {boolean}
<span class='linenumber'> 30</span>  * @private
<span class='linenumber'> 31</span>  */</span><span class="WHIT">
<span class='linenumber'> 32</span> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">DEBUG</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'> 33</span> 
<span class='linenumber'> 34</span> </span><span class="COMM">//======================== External Namespace ==================================</span><span class="WHIT">
<span class='linenumber'> 35</span> </span><span class="COMM">/**
<span class='linenumber'> 36</span>  * External namespace for &lt;code>gadgets&lt;/code> for internal reference.
<span class='linenumber'> 37</span>  * @static
<span class='linenumber'> 38</span>  * @class
<span class='linenumber'> 39</span>  * @name gadgets
<span class='linenumber'> 40</span>  */</span><span class="WHIT">
<span class='linenumber'> 41</span> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">gadgets</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">window</span><span class="PUNC">[</span><span class="STRN">'gadgets'</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'> 42</span> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">gadgets</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'> 43</span>   </span><span class="NAME">INFO</span><span class="PUNC">(</span><span class="STRN">'gadgets.* not found.'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'> 44</span> </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'> 45</span> 
<span class='linenumber'> 46</span> 
<span class='linenumber'> 47</span> </span><span class="COMM">/**
<span class='linenumber'> 48</span>  * External namespace for &lt;code>opensocial&lt;/code> for internal reference.
<span class='linenumber'> 49</span>  * @static
<span class='linenumber'> 50</span>  * @class
<span class='linenumber'> 51</span>  * @name opensocial
<span class='linenumber'> 52</span>  */</span><span class="WHIT">
<span class='linenumber'> 53</span> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">opensocial</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">window</span><span class="PUNC">[</span><span class="STRN">'opensocial'</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'> 54</span> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">gadgets</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'> 55</span>   </span><span class="NAME">INFO</span><span class="PUNC">(</span><span class="STRN">'opensocial.* not found.'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'> 56</span> </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'> 57</span> 
<span class='linenumber'> 58</span> 
<span class='linenumber'> 59</span> </span><span class="COMM">/**
<span class='linenumber'> 60</span>  * Namespace for top-level api functions.
<span class='linenumber'> 61</span>  * @static
<span class='linenumber'> 62</span>  * @class
<span class='linenumber'> 63</span>  * @name flashAPI
<span class='linenumber'> 64</span>  */</span><span class="WHIT">
<span class='linenumber'> 65</span> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">flashAPI</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'> 66</span> </span><span class="COMM">// Exports the namespace</span><span class="WHIT">
<span class='linenumber'> 67</span> </span><span class="COMM">// All methods in this namespace is exposed to flash</span><span class="WHIT">
<span class='linenumber'> 68</span> </span><span class="NAME">window</span><span class="PUNC">[</span><span class="STRN">'flashAPI'</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">flashAPI</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'> 69</span> 
<span class='linenumber'> 70</span> 
<span class='linenumber'> 71</span> 
<span class='linenumber'> 72</span> </span><span class="COMM">/**
<span class='linenumber'> 73</span>  * The Opensocial Javascript API version.
<span class='linenumber'> 74</span>  * @member flashAPI
<span class='linenumber'> 75</span>  * @type {number}
<span class='linenumber'> 76</span>  */</span><span class="WHIT">
<span class='linenumber'> 77</span> </span><span class="NAME">flashAPI.VERSON</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">0.7</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'> 78</span> 
<span class='linenumber'> 79</span> </span><span class="COMM">/**
<span class='linenumber'> 80</span>  * The default flash id embeded in container.
<span class='linenumber'> 81</span>  * @member flashAPI
<span class='linenumber'> 82</span>  * @private
<span class='linenumber'> 83</span>  * @type {string}
<span class='linenumber'> 84</span>  */</span><span class="WHIT">
<span class='linenumber'> 85</span> </span><span class="NAME">flashAPI.DEFAULT_FLASH_ID</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">"flashObj"</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'> 86</span> 
<span class='linenumber'> 87</span> </span><span class="COMM">//--------------------------- Environment --------------------------------------</span><span class="WHIT">
<span class='linenumber'> 88</span> 
<span class='linenumber'> 89</span> </span><span class="COMM">/**
<span class='linenumber'> 90</span>  * The flash movie object which apply this API.
<span class='linenumber'> 91</span>  * This object is initialized in &lt;code>flashAPI.isAPIReady&lt;/code> function.
<span class='linenumber'> 92</span>  * @member flashAPI
<span class='linenumber'> 93</span>  * @type {HTMLElement}
<span class='linenumber'> 94</span>  */</span><span class="WHIT">
<span class='linenumber'> 95</span> </span><span class="NAME">flashAPI.swfObj</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'> 96</span> 
<span class='linenumber'> 97</span> 
<span class='linenumber'> 98</span> </span><span class="COMM">/**
<span class='linenumber'> 99</span>  * Indicates if the opensocial library is loaded. 
<span class='linenumber'>100</span>  * Initialize the &lt;code>opensocial&lt;/code> and &lt;code>gadgets&lt;/code> namespaces.
<span class='linenumber'>101</span>  * Initialize the &lt;code>flashAPI.swfObj&lt;/code> element. 
<span class='linenumber'>102</span>  *
<span class='linenumber'>103</span>  * The objectId of the swf is defined in gagdet spec. If the swf is embeded by
<span class='linenumber'>104</span>  * calling &lt;code>flashAPI.embededFlash&lt;/code> function, the detault objectId 
<span class='linenumber'>105</span>  * will be 'flashAPI.swfObj'.
<span class='linenumber'>106</span>  *
<span class='linenumber'>107</span>  * This function is called by the swf's ExternalInterface continuingly until it
<span class='linenumber'>108</span>  * returns true.
<span class='linenumber'>109</span>  *
<span class='linenumber'>110</span>  * @see //flash/actionscript/com/google/ccc/chinasocial/api/API.as
<span class='linenumber'>111</span>  * @requires opensocial
<span class='linenumber'>112</span>  * @member flashAPI
<span class='linenumber'>113</span>  *
<span class='linenumber'>114</span>  * @param {string?} objectId The object Id passed from the swf.
<span class='linenumber'>115</span>  * @return {boolean} true if all javascripts are loaded.
<span class='linenumber'>116</span>  */</span><span class="WHIT">
<span class='linenumber'>117</span> </span><span class="NAME">flashAPI.isAPIReady</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">objectId</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>118</span> </span><span class="WHIT">  </span><span class="KEYW">try</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>119</span> </span><span class="WHIT">    </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">flashAPI.swfObj</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>120</span> </span><span class="WHIT">      </span><span class="NAME">flashAPI.swfObj</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">flashAPI.thisFlash</span><span class="PUNC">(</span><span class="NAME">objectId</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>121</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>122</span> </span><span class="WHIT">    </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">flashAPI.swfObj</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>123</span>       </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="WHIT">
<span class='linenumber'>124</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>125</span> </span><span class="WHIT">      </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>126</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>127</span> </span><span class="WHIT">  </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">catch</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">e</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>128</span> </span><span class="WHIT">    </span><span class="NAME">INFO</span><span class="PUNC">(</span><span class="NAME">e</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>129</span> </span><span class="WHIT">    </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>130</span> </span><span class="WHIT">  </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>131</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>132</span> 
<span class='linenumber'>133</span> 
<span class='linenumber'>134</span> </span><span class="COMM">/**
<span class='linenumber'>135</span>  * Because &lt;code>gadgets.flash.embedFlash&lt;/code> cannot auto activate it in IE6,
<span class='linenumber'>136</span>  * so here we need a special one.
<span class='linenumber'>137</span>  * @requires gadgets.flash
<span class='linenumber'>138</span>  * @member flashAPI
<span class='linenumber'>139</span>  * @param {string} swfUrl  The swf file's location.
<span class='linenumber'>140</span>  * @param {string} swfContainer  The HTML element id.
<span class='linenumber'>141</span>  * @param {string?} opt_playerVersion Required flash player version.
<span class='linenumber'>142</span>  * @param {Object.&lt;string, string>?} opt_params Flash object's parameters.
<span class='linenumber'>143</span>  * @param {string?} opt_upgradeMsgHTML  
<span class='linenumber'>144</span>  *        The message if the browser's version needs to be upgraded.
<span class='linenumber'>145</span>  */</span><span class="WHIT">
<span class='linenumber'>146</span> </span><span class="NAME">flashAPI.embedFlash</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">swfUrl</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">swfContainer</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">opt_playerVersion</span><span class="PUNC">,</span><span class="WHIT"> 
<span class='linenumber'>147</span>                                </span><span class="NAME">opt_params</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">opt_upgradeMsgHTML</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>148</span> </span><span class="WHIT">  </span><span class="COMM">// Check container element</span><span class="WHIT">
<span class='linenumber'>149</span> </span><span class="WHIT">  </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">container</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">document.getElementById</span><span class="PUNC">(</span><span class="NAME">swfContainer</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>150</span> </span><span class="WHIT">  </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">container</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>151</span> 
<span class='linenumber'>152</span> </span><span class="WHIT">  </span><span class="COMM">// Check version</span><span class="WHIT">
<span class='linenumber'>153</span> </span><span class="WHIT">  </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">version</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">opt_playerVersion.match</span><span class="PUNC">(</span><span class="REGX">/(\d+)(?=[\.,]?)/g</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>154</span> </span><span class="WHIT">  </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">expectMajorVer</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">version</span><span class="WHIT"> </span><span class="PUNC">!=</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT"> </span><span class="NAME">Number</span><span class="PUNC">(</span><span class="NAME">version</span><span class="PUNC">[</span><span class="NUMB">0</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NUMB">9</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>155</span> </span><span class="WHIT">  </span><span class="NAME">EXPORT</span><span class="PUNC">(</span><span class="STRN">"currentVer"</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">gadgets.flash.getMajorVersion</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>156</span> </span><span class="WHIT">  </span><span class="NAME">EXPORT</span><span class="PUNC">(</span><span class="STRN">"expectVer"</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">expectMajorVer</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>157</span> </span><span class="WHIT">  </span><span class="WHIT">
<span class='linenumber'>158</span> </span><span class="WHIT">  </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">gadgets.flash.getMajorVersion</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">&lt;</span><span class="WHIT"> </span><span class="NAME">expectMajorVer</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>159</span> </span><span class="WHIT">    </span><span class="NAME">opt_upgradeMsgHTML</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">opt_upgradeMsgHTML</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="WHIT">
<span class='linenumber'>160</span> </span><span class="WHIT">        </span><span class="STRN">'&lt;span style="font-size:small;color:#777;"> '</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT">
<span class='linenumber'>161</span>         </span><span class="STRN">'Please install or upgrade to '</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT">
<span class='linenumber'>162</span> </span><span class="WHIT">        </span><span class="STRN">'&lt;a href="http://www.adobe.com/cn/products/flashplayer/" '</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT">
<span class='linenumber'>163</span> </span><span class="WHIT">        </span><span class="STRN">'style="color:#36C;" target="_blank">Flash Player 9.0&lt;/a>.&lt;/span>'</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>164</span> </span><span class="WHIT">    </span><span class="NAME">container.innerHTML</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">opt_upgradeMsgHTML</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>165</span> </span><span class="WHIT">    </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>166</span> </span><span class="WHIT">  </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>167</span> 
<span class='linenumber'>168</span> </span><span class="WHIT">  </span><span class="COMM">// Generate the flash object element</span><span class="WHIT">
<span class='linenumber'>169</span> </span><span class="WHIT">  </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">html</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">""</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>170</span> </span><span class="WHIT">  </span><span class="NAME">opt_params</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">opt_params</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>171</span> </span><span class="WHIT">  </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">navigator.plugins</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">navigator.mimeTypes</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">navigator.mimeTypes.length</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>172</span>     </span><span class="COMM">// netscape plugin architecture</span><span class="WHIT">
<span class='linenumber'>173</span> </span><span class="WHIT">    </span><span class="NAME">html</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">'&lt;embed src="'</span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">swfUrl</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT">
<span class='linenumber'>174</span>            </span><span class="STRN">'" id="'</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">flashAPI.DEFAULT_FLASH_ID</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> 
<span class='linenumber'>175</span>            </span><span class="STRN">'" name="'</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">flashAPI.DEFAULT_FLASH_ID</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> 
<span class='linenumber'>176</span>            </span><span class="STRN">'" type="application/x-shockwave-flash"'</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>177</span> </span><span class="WHIT">    </span><span class="KEYW">for</span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">key</span><span class="WHIT"> </span><span class="KEYW">in</span><span class="WHIT"> </span><span class="NAME">opt_params</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT"> </span><span class="WHIT">
<span class='linenumber'>178</span> </span><span class="WHIT">      </span><span class="NAME">html</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">key</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="STRN">'="'</span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">opt_params</span><span class="PUNC">[</span><span class="NAME">key</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="STRN">'" '</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>179</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>180</span> </span><span class="WHIT">    </span><span class="NAME">html</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">'/>'</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>181</span> </span><span class="WHIT">  </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>182</span>     </span><span class="COMM">// PC IE</span><span class="WHIT">
<span class='linenumber'>183</span> </span><span class="WHIT">    </span><span class="NAME">html</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">'&lt;object id="'</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">flashAPI.DEFAULT_FLASH_ID</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> 
<span class='linenumber'>184</span>            </span><span class="STRN">'" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>185</span> </span><span class="WHIT">    </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">params</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">'&lt;param name="movie" value="'</span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">swfUrl</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="STRN">'" />'</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>186</span> </span><span class="WHIT">    </span><span class="KEYW">for</span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">key</span><span class="WHIT"> </span><span class="KEYW">in</span><span class="WHIT"> </span><span class="NAME">opt_params</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>187</span> </span><span class="WHIT">      </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">key</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="STRN">'width'</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="NAME">key</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="STRN">'height'</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>188</span> </span><span class="WHIT">        </span><span class="NAME">html</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">' '</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">key</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">'="'</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">opt_params</span><span class="PUNC">[</span><span class="NAME">key</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">'"'</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>189</span> </span><span class="WHIT">      </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>190</span> </span><span class="WHIT">        </span><span class="NAME">params</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">'&lt;param name="'</span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">key</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="STRN">'" value="'</span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">opt_params</span><span class="PUNC">[</span><span class="NAME">key</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="STRN">'" />'</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>191</span> </span><span class="WHIT">      </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>192</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>193</span> </span><span class="WHIT">    </span><span class="NAME">html</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">'>'</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">params</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">"&lt;/object>"</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>194</span> </span><span class="WHIT">  </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>195</span> </span><span class="WHIT">  </span><span class="NAME">container.innerHTML</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">html</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>196</span> </span><span class="WHIT">  </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>197</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>198</span> 
<span class='linenumber'>199</span> 
<span class='linenumber'>200</span> </span><span class="COMM">/**
<span class='linenumber'>201</span>  * Returns the env object for container
<span class='linenumber'>202</span>  * @requires gadgets.views
<span class='linenumber'>203</span>  * @see //flash/actionscript/com/google/ccc/chinasocial/api/API.as
<span class='linenumber'>204</span>  * @member flashAPI
<span class='linenumber'>205</span>  * @return {Object} a map of all environment values.
<span class='linenumber'>206</span>  */</span><span class="WHIT">
<span class='linenumber'>207</span> </span><span class="NAME">flashAPI.getEnvironment</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>208</span> </span><span class="WHIT">  </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">envObj_</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>209</span> </span><span class="WHIT">  </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">opensocial.getEnvironment</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>210</span> </span><span class="WHIT">    </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">env</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">opensocial.getEnvironment</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>211</span> </span><span class="WHIT">    </span><span class="NAME">envObj_.domain</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">env.getDomain</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>212</span> </span><span class="WHIT">    </span><span class="WHIT">
<span class='linenumber'>213</span> </span><span class="WHIT">    </span><span class="COMM">// TODO Add support field check</span><span class="WHIT">
<span class='linenumber'>214</span> </span><span class="WHIT">    </span><span class="WHIT">
<span class='linenumber'>215</span> </span><span class="WHIT">  </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>216</span> </span><span class="WHIT">    </span><span class="COMM">// TODO Here is work around!</span><span class="WHIT">
<span class='linenumber'>217</span> </span><span class="WHIT">    </span><span class="NAME">envObj_.domain</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">flashAPI.extractDomain</span><span class="PUNC">(</span><span class="NAME">document.referrer</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>218</span> </span><span class="WHIT">  </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>219</span> </span><span class="WHIT">  </span><span class="WHIT">
<span class='linenumber'>220</span> </span><span class="WHIT">  </span><span class="COMM">// Default view type</span><span class="WHIT">
<span class='linenumber'>221</span> </span><span class="WHIT">  </span><span class="NAME">envObj_.view</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">'profile'</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>222</span> </span><span class="WHIT">    </span><span class="WHIT">
<span class='linenumber'>223</span> </span><span class="WHIT">  </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">gadgets</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>224</span> </span><span class="WHIT">    </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">gadgets.views</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>225</span> </span><span class="WHIT">      </span><span class="NAME">envObj_.view</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">gadgets.views.getCurrentView</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">getName</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>226</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>227</span> </span><span class="WHIT">  </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>228</span> </span><span class="WHIT">  </span><span class="NAME">EXPORT</span><span class="PUNC">(</span><span class="STRN">'env'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">envObj_</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">  </span><span class="COMM">// for debugging</span><span class="WHIT">
<span class='linenumber'>229</span> </span><span class="WHIT">  </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">envObj_</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>230</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>231</span> 
<span class='linenumber'>232</span> 
<span class='linenumber'>233</span> </span><span class="COMM">/**
<span class='linenumber'>234</span>  * Set the width for the flash stage
<span class='linenumber'>235</span>  * Very usefull for dynamic loading and view switching.
<span class='linenumber'>236</span>  * TODO: need some check!
<span class='linenumber'>237</span>  * @member flashAPI
<span class='linenumber'>238</span>  * @param {number} newWidth New width (in pixel) to be applied.
<span class='linenumber'>239</span>  */</span><span class="WHIT">
<span class='linenumber'>240</span> </span><span class="NAME">flashAPI.setStageWidth</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">newWidth</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>241</span> </span><span class="WHIT">  </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">flashAPI.swfObj.width</span><span class="WHIT"> </span><span class="PUNC">!=</span><span class="WHIT"> </span><span class="NAME">newWidth</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>242</span> </span><span class="WHIT">    </span><span class="NAME">flashAPI.swfObj.width</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">newWidth</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>243</span> </span><span class="WHIT">  </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>244</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>245</span> 
<span class='linenumber'>246</span> 
<span class='linenumber'>247</span> </span><span class="COMM">/**
<span class='linenumber'>248</span>  * Set the height for the flash stage
<span class='linenumber'>249</span>  * Very usefull for dynamic loading and view switching
<span class='linenumber'>250</span>  * TODO: need some check!
<span class='linenumber'>251</span>  * @requires gadgets.window
<span class='linenumber'>252</span>  * @member flashAPI
<span class='linenumber'>253</span>  * @param {number} newHeight New height (in pixel) to be applied.
<span class='linenumber'>254</span>  */</span><span class="WHIT">
<span class='linenumber'>255</span> </span><span class="NAME">flashAPI.setStageHeight</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">newHeight</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>256</span> </span><span class="WHIT">  </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">flashAPI.swfObj.height</span><span class="WHIT"> </span><span class="PUNC">!=</span><span class="WHIT"> </span><span class="NAME">newHeight</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>257</span> </span><span class="WHIT">    </span><span class="NAME">flashAPI.swfObj.height</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">newHeight</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>258</span> </span><span class="WHIT">    </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">gadgets</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">gadgets.window</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">gadgets.window.adjustHeight</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>259</span> </span><span class="WHIT">      </span><span class="NAME">gadgets.window.adjustHeight</span><span class="PUNC">(</span><span class="NAME">newHeight</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>260</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>261</span> </span><span class="WHIT">  </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>262</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>263</span> 
<span class='linenumber'>264</span> 
<span class='linenumber'>265</span> </span><span class="COMM">//--------------------- Data requests senders ----------------------------------</span><span class="WHIT">
<span class='linenumber'>266</span> </span><span class="COMM">/**
<span class='linenumber'>267</span>  * Sends out the request for basic data set.
<span class='linenumber'>268</span>  * NOTE:
<span class='linenumber'>269</span>  * Here we pass JSON string instead of an object to Flash via the callback.
<span class='linenumber'>270</span>  * See comments of 'handleFetchBasicData' method in the API.as file.
<span class='linenumber'>271</span>  *
<span class='linenumber'>272</span>  * @see //flash/actionscript/com/google/ccc/chinasocial/api/API.as
<span class='linenumber'>273</span>  * @see //flash/actionscript/com/google/ccc/chinasocial/api/BasicData.as
<span class='linenumber'>274</span>  * @member flashAPI
<span class='linenumber'>275</span>  * 
<span class='linenumber'>276</span>  * @param {string} reqID The request id.
<span class='linenumber'>277</span>  * @param {Array.&lt;string>} keys The app keys.
<span class='linenumber'>278</span>  * @param {Object.&lt;string, Object>} params 
<span class='linenumber'>279</span>  *        A map of PeopleRequestField's names and values.
<span class='linenumber'>280</span>  */</span><span class="WHIT">
<span class='linenumber'>281</span> </span><span class="NAME">flashAPI.fetchBasicData</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">reqID</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">keys</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">params</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>282</span> 
<span class='linenumber'>283</span> </span><span class="WHIT">  </span><span class="NAME">EXPORT</span><span class="PUNC">(</span><span class="STRN">'params_'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">params</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="COMM">// for debug</span><span class="WHIT">
<span class='linenumber'>284</span> 
<span class='linenumber'>285</span> </span><span class="WHIT">  </span><span class="NAME">params</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">flashAPI.wrapParams</span><span class="PUNC">(</span><span class="WHIT">
<span class='linenumber'>286</span> </span><span class="WHIT">      </span><span class="NAME">params</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">opensocial.DataRequest.PeopleRequestFields</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>287</span> </span><span class="WHIT">
<span class='linenumber'>288</span> </span><span class="WHIT">  </span><span class="COMM">// The params object need to be cloned, because req.add method will modify it!</span><span class="WHIT">
<span class='linenumber'>289</span> </span><span class="WHIT">  </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">req</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">opensocial.newDataRequest</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>290</span> </span><span class="WHIT">  </span><span class="NAME">req.add</span><span class="PUNC">(</span><span class="NAME">req.newFetchPersonRequest</span><span class="PUNC">(</span><span class="STRN">'OWNER'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="WHIT">
<span class='linenumber'>291</span> </span><span class="WHIT">      </span><span class="NAME">flashAPI.cloneObject</span><span class="PUNC">(</span><span class="NAME">params</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">'o'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>292</span> </span><span class="WHIT">  </span><span class="NAME">req.add</span><span class="PUNC">(</span><span class="NAME">req.newFetchPersonRequest</span><span class="PUNC">(</span><span class="STRN">'VIEWER'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="WHIT">
<span class='linenumber'>293</span> </span><span class="WHIT">      </span><span class="NAME">flashAPI.cloneObject</span><span class="PUNC">(</span><span class="NAME">params</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">'v'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>294</span> </span><span class="WHIT">  </span><span class="NAME">req.add</span><span class="PUNC">(</span><span class="NAME">req.newFetchPeopleRequest</span><span class="PUNC">(</span><span class="STRN">'OWNER_FRIENDS'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="WHIT">
<span class='linenumber'>295</span> </span><span class="WHIT">      </span><span class="NAME">flashAPI.cloneObject</span><span class="PUNC">(</span><span class="NAME">params</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">'of'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>296</span> </span><span class="WHIT">  </span><span class="NAME">req.add</span><span class="PUNC">(</span><span class="NAME">req.newFetchPeopleRequest</span><span class="PUNC">(</span><span class="STRN">'VIEWER_FRIENDS'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="WHIT">
<span class='linenumber'>297</span> </span><span class="WHIT">      </span><span class="NAME">flashAPI.cloneObject</span><span class="PUNC">(</span><span class="NAME">params</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">'vf'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>298</span> </span><span class="WHIT">  </span><span class="WHIT">
<span class='linenumber'>299</span> </span><span class="WHIT">  </span><span class="COMM">/* TODO Not support by our container yet
<span class='linenumber'>300</span>   req.add(req.newFetchPersonAppDataRequest('OWNER', keys), 'od');
<span class='linenumber'>301</span>   req.add(req.newFetchPersonAppDataRequest('VIEWER', keys), 'vd');
<span class='linenumber'>302</span>   */</span><span class="WHIT">
<span class='linenumber'>303</span> </span><span class="WHIT">  </span><span class="WHIT">
<span class='linenumber'>304</span> </span><span class="WHIT">  </span><span class="NAME">req.send</span><span class="PUNC">(</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">dataResponse</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>305</span> </span><span class="WHIT">    </span><span class="KEYW">try</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>306</span> </span><span class="WHIT">      </span><span class="NAME">EXPORT</span><span class="PUNC">(</span><span class="STRN">'raw'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">dataResponse</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="COMM">// for debug</span><span class="WHIT">
<span class='linenumber'>307</span> 
<span class='linenumber'>308</span> </span><span class="WHIT">      </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">basicData_</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">flashAPI.BasicData</span><span class="PUNC">(</span><span class="NAME">dataResponse</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>309</span> 
<span class='linenumber'>310</span> </span><span class="WHIT">      </span><span class="NAME">EXPORT</span><span class="PUNC">(</span><span class="STRN">'basic_'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">basicData_</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="COMM">// for debug</span><span class="WHIT">
<span class='linenumber'>311</span> </span><span class="WHIT">      </span><span class="WHIT">
<span class='linenumber'>312</span> </span><span class="WHIT">      </span><span class="NAME">flashAPI.swfObj.handleFetchBasicData</span><span class="PUNC">(</span><span class="NAME">reqID</span><span class="PUNC">,</span><span class="WHIT">
<span class='linenumber'>313</span>           </span><span class="NAME">gadgets.json.stringify</span><span class="PUNC">(</span><span class="NAME">basicData_</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>314</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">catch</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">e</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>315</span> </span><span class="WHIT">      </span><span class="NAME">flashAPI.swfObj.handleError</span><span class="PUNC">(</span><span class="NAME">reqID</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">e</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">  </span><span class="WHIT">
<span class='linenumber'>316</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>317</span> </span><span class="WHIT">  </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>318</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>319</span> 
<span class='linenumber'>320</span> 
<span class='linenumber'>321</span> </span><span class="COMM">/**
<span class='linenumber'>322</span>  * Sends out the request for friends of a person.
<span class='linenumber'>323</span>  * @member flashAPI
<span class='linenumber'>324</span>  * 
<span class='linenumber'>325</span>  * @param {string} reqID The request id.
<span class='linenumber'>326</span>  * @param {string} idSpec OWNER | VIEWER | OWNER_FRIENDS | VIEWER_FRIENDS | Id.
<span class='linenumber'>327</span>  * @param {Object.&lt;string, Object>} params 
<span class='linenumber'>328</span>  *            A map of PeopleRequestField's names and values.
<span class='linenumber'>329</span>  */</span><span class="WHIT">
<span class='linenumber'>330</span> </span><span class="NAME">flashAPI.fetchPeople</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">reqID</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">idSpec</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">params</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>331</span> </span><span class="WHIT">  </span><span class="NAME">params</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">flashAPI.wrapParams</span><span class="PUNC">(</span><span class="WHIT">
<span class='linenumber'>332</span> </span><span class="WHIT">      </span><span class="NAME">params</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">opensocial.DataRequest.PeopleRequestFields</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>333</span> 
<span class='linenumber'>334</span> </span><span class="WHIT">  </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">req</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">opensocial.newDataRequest</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>335</span> </span><span class="WHIT">  </span><span class="NAME">req.add</span><span class="PUNC">(</span><span class="NAME">req.newFetchPeopleRequest</span><span class="PUNC">(</span><span class="NAME">idSpec</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">params</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">'f'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>336</span> </span><span class="WHIT">  </span><span class="NAME">req.send</span><span class="PUNC">(</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">dataResponse</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>337</span> </span><span class="WHIT">    </span><span class="KEYW">try</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>338</span> </span><span class="WHIT">      </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">people_</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">flashAPI.getPeople</span><span class="PUNC">(</span><span class="NAME">dataResponse</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">'f'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>339</span> </span><span class="WHIT">      </span><span class="NAME">flashAPI.swfObj.handleFetchPeople</span><span class="PUNC">(</span><span class="NAME">reqID</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">gadgets.json.stringify</span><span class="PUNC">(</span><span class="NAME">people_</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>340</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">catch</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">e</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>341</span> </span><span class="WHIT">      </span><span class="NAME">flashAPI.swfObj.handleError</span><span class="PUNC">(</span><span class="NAME">reqID</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">e</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>342</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="WHIT">
<span class='linenumber'>343</span> </span><span class="WHIT">  </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>344</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>345</span> 
<span class='linenumber'>346</span> 
<span class='linenumber'>347</span> </span><span class="COMM">/**
<span class='linenumber'>348</span>  * Sends out the request for a person. 
<span class='linenumber'>349</span>  * @member flashAPI
<span class='linenumber'>350</span>  * 
<span class='linenumber'>351</span>  * @param {string} reqID The request id.
<span class='linenumber'>352</span>  * @param {string} id OWNER | VIEWER | Person Id.
<span class='linenumber'>353</span>  * @param {Object.&lt;string, Object>} params 
<span class='linenumber'>354</span>  *        A map of PeopleRequestField's names and values.
<span class='linenumber'>355</span>  */</span><span class="WHIT">
<span class='linenumber'>356</span> </span><span class="NAME">flashAPI.fetchPerson</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">reqID</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">id</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">params</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>357</span> </span><span class="WHIT">  </span><span class="NAME">params</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">flashAPI.wrapParams</span><span class="PUNC">(</span><span class="WHIT">
<span class='linenumber'>358</span> </span><span class="WHIT">      </span><span class="NAME">params</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">opensocial.DataRequest.PeopleRequestFields</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>359</span> 
<span class='linenumber'>360</span> </span><span class="WHIT">  </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">req</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">opensocial.newDataRequest</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>361</span> </span><span class="WHIT">  </span><span class="NAME">req.add</span><span class="PUNC">(</span><span class="NAME">req.newFetchPersonRequest</span><span class="PUNC">(</span><span class="NAME">id</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">params</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">'p'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>362</span> </span><span class="WHIT">  </span><span class="NAME">req.send</span><span class="PUNC">(</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">dataResponse</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>363</span> </span><span class="WHIT">    </span><span class="KEYW">try</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>364</span> </span><span class="WHIT">      </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">person_</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">flashAPI.getPerson</span><span class="PUNC">(</span><span class="NAME">dataResponse</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">'p'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>365</span> </span><span class="WHIT">      </span><span class="NAME">flashAPI.swfObj.handleFetchPerson</span><span class="PUNC">(</span><span class="NAME">reqID</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">gadgets.json.stringify</span><span class="PUNC">(</span><span class="NAME">person_</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>366</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">catch</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">e</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>367</span> </span><span class="WHIT">      </span><span class="NAME">flashAPI.swfObj.handleError</span><span class="PUNC">(</span><span class="NAME">reqID</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">e</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">  </span><span class="WHIT">
<span class='linenumber'>368</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="WHIT">
<span class='linenumber'>369</span> </span><span class="WHIT">  </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>370</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>371</span> 
<span class='linenumber'>372</span> 
<span class='linenumber'>373</span> </span><span class="COMM">/**
<span class='linenumber'>374</span>  * Sends out the request for a person and his/her friends. 
<span class='linenumber'>375</span>  * @member flashAPI
<span class='linenumber'>376</span>  * 
<span class='linenumber'>377</span>  * @param {string} reqID The request id.
<span class='linenumber'>378</span>  * @param {string} id OWNER | VIEWER | Person Id.
<span class='linenumber'>379</span>  * @param {Object.&lt;string, Object>} params 
<span class='linenumber'>380</span>  *        A map of PeopleRequestField's names and values.
<span class='linenumber'>381</span>  */</span><span class="WHIT">
<span class='linenumber'>382</span> </span><span class="NAME">flashAPI.fetchPersonFriends</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">reqID</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">id</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">params</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>383</span> </span><span class="WHIT">  </span><span class="NAME">params</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">flashAPI.wrapParams</span><span class="PUNC">(</span><span class="WHIT">
<span class='linenumber'>384</span> </span><span class="WHIT">      </span><span class="NAME">params</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">opensocial.DataRequest.PeopleRequestFields</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>385</span> 
<span class='linenumber'>386</span> </span><span class="WHIT">  </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">req</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">opensocial.newDataRequest</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>387</span> </span><span class="WHIT">  </span><span class="NAME">req.add</span><span class="PUNC">(</span><span class="NAME">req.newFetchPersonRequest</span><span class="PUNC">(</span><span class="NAME">id</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="WHIT">
<span class='linenumber'>388</span> </span><span class="WHIT">      </span><span class="NAME">flashAPI.cloneObject</span><span class="PUNC">(</span><span class="NAME">params</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">'p'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>389</span> </span><span class="WHIT">  </span><span class="NAME">req.add</span><span class="PUNC">(</span><span class="NAME">req.newFetchPeopleRequest</span><span class="PUNC">(</span><span class="NAME">id</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="WHIT">
<span class='linenumber'>390</span> </span><span class="WHIT">      </span><span class="NAME">flashAPI.cloneObject</span><span class="PUNC">(</span><span class="NAME">params</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">'f'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>391</span> </span><span class="WHIT">  </span><span class="NAME">req.send</span><span class="PUNC">(</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">dataResponse</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>392</span> </span><span class="WHIT">    </span><span class="KEYW">try</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>393</span> </span><span class="WHIT">      </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">person_</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">flashAPI.getPerson</span><span class="PUNC">(</span><span class="NAME">dataResponse</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">'p'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>394</span> </span><span class="WHIT">      </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">friends_</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">flashAPI.getPeople</span><span class="PUNC">(</span><span class="NAME">dataResponse</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">'f'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>395</span> </span><span class="WHIT">      </span><span class="NAME">flashAPI.swfObj.handleFetchPersonFriends</span><span class="PUNC">(</span><span class="NAME">reqID</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="WHIT">
<span class='linenumber'>396</span> </span><span class="WHIT">          </span><span class="NAME">gadgets.json.stringify</span><span class="PUNC">(</span><span class="NAME">person_</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="WHIT">
<span class='linenumber'>397</span>           </span><span class="NAME">gadgets.json.stringify</span><span class="PUNC">(</span><span class="NAME">friends_</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>398</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">catch</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">e</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>399</span> </span><span class="WHIT">      </span><span class="NAME">flashAPI.swfObj.handleError</span><span class="PUNC">(</span><span class="NAME">reqID</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">e</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>400</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="WHIT">
<span class='linenumber'>401</span> </span><span class="WHIT">  </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>402</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>403</span> 
<span class='linenumber'>404</span> 
<span class='linenumber'>405</span> </span><span class="COMM">/**
<span class='linenumber'>406</span>  * Sends out the request for personal app data. 
<span class='linenumber'>407</span>  * @member flashAPI
<span class='linenumber'>408</span>  * 
<span class='linenumber'>409</span>  * @param {string} reqID The request id.
<span class='linenumber'>410</span>  * @param {string|Array.&lt;string>} idSpec OWNER | VIEWER | Id | Array of Ids.
<span class='linenumber'>411</span>  * @param {Array.&lt;string>} keys App keys.
<span class='linenumber'>412</span>  */</span><span class="WHIT">
<span class='linenumber'>413</span> </span><span class="NAME">flashAPI.fetchPersonAppData</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">reqID</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">idSpec</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">keys</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>414</span> </span><span class="WHIT">  </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">req</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">opensocial.newDataRequest</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>415</span> </span><span class="WHIT">  </span><span class="NAME">req.add</span><span class="PUNC">(</span><span class="NAME">req.newFetchPersonAppDataRequest</span><span class="PUNC">(</span><span class="NAME">idSpec</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">keys</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">'d'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>416</span> </span><span class="WHIT">  </span><span class="NAME">req.send</span><span class="PUNC">(</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">dataResponse</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>417</span> </span><span class="WHIT">    </span><span class="KEYW">try</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>418</span> </span><span class="WHIT">      </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">dataObj</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">flashAPI.getData</span><span class="PUNC">(</span><span class="NAME">dataResponse</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">'d'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>419</span> </span><span class="WHIT">      </span><span class="NAME">flashAPI.swfObj.handleFetchPersonAppData</span><span class="PUNC">(</span><span class="NAME">reqID</span><span class="PUNC">,</span><span class="WHIT">
<span class='linenumber'>420</span>           </span><span class="NAME">gadgets.json.stringify</span><span class="PUNC">(</span><span class="NAME">dataObj</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>421</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">catch</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">e</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>422</span> </span><span class="WHIT">      </span><span class="NAME">flashAPI.swfObj.handleError</span><span class="PUNC">(</span><span class="NAME">reqID</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">e</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">  </span><span class="WHIT">
<span class='linenumber'>423</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="WHIT">
<span class='linenumber'>424</span> </span><span class="WHIT">  </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>425</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>426</span> 
<span class='linenumber'>427</span> 
<span class='linenumber'>428</span> </span><span class="COMM">/**
<span class='linenumber'>429</span>  * Sends out the update request for personal app data. 
<span class='linenumber'>430</span>  * @member flashAPI
<span class='linenumber'>431</span>  * 
<span class='linenumber'>432</span>  * @param {string} reqID The request id.
<span class='linenumber'>433</span>  * @param {string} id OWNER | VIEWER | Person Id.
<span class='linenumber'>434</span>  * @param {string} key The data key in this app.
<span class='linenumber'>435</span>  * @param {Object} value New value.
<span class='linenumber'>436</span>  */</span><span class="WHIT">
<span class='linenumber'>437</span> </span><span class="NAME">flashAPI.updatePersonAppData</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">reqID</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">id</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">key</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">value</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>438</span> </span><span class="WHIT">  </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">req</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">opensocial.newDataRequest</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>439</span> </span><span class="WHIT">  </span><span class="NAME">req.add</span><span class="PUNC">(</span><span class="NAME">req.newUpdatePersonAppDataRequest</span><span class="PUNC">(</span><span class="NAME">id</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">key</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">value</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>440</span> </span><span class="WHIT">  </span><span class="NAME">req.send</span><span class="PUNC">(</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">dataResponse</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>441</span> </span><span class="WHIT">    </span><span class="COMM">// TODO: deal with error</span><span class="WHIT">
<span class='linenumber'>442</span> </span><span class="WHIT">    </span><span class="NAME">flashAPI.swfObj.handleUpdatePersonAppData</span><span class="PUNC">(</span><span class="NAME">reqID</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>443</span> </span><span class="WHIT">  </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>444</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>445</span> 
<span class='linenumber'>446</span> </span><span class="COMM">/**
<span class='linenumber'>447</span>  * Sends out the request for personal activities.
<span class='linenumber'>448</span>  * @member flashAPI
<span class='linenumber'>449</span>  * 
<span class='linenumber'>450</span>  * @param {string} reqID The request id
<span class='linenumber'>451</span>  * @param {string} id OWNER | VIEWER | Person Id
<span class='linenumber'>452</span>  * @param {Object.&lt;ActivityRequestField.name, Object>} params 
<span class='linenumber'>453</span>  *            A map of ActivityRequestField's names and values
<span class='linenumber'>454</span>  */</span><span class="WHIT">
<span class='linenumber'>455</span> </span><span class="NAME">flashAPI.fetchActivities</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">reqID</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">id</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">params</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>456</span> </span><span class="WHIT">  </span><span class="NAME">params</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">flashAPI.wrapParams</span><span class="PUNC">(</span><span class="WHIT">
<span class='linenumber'>457</span> </span><span class="WHIT">      </span><span class="NAME">params</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">opensocial.DataRequest.ActivityRequestFields</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>458</span> 
<span class='linenumber'>459</span> </span><span class="WHIT">  </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">req</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">opensocial.newDataRequest</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>460</span> </span><span class="WHIT">  </span><span class="NAME">req.add</span><span class="PUNC">(</span><span class="NAME">req.newFetchActivitiesRequest</span><span class="PUNC">(</span><span class="NAME">id</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">params</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">'a'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>461</span> </span><span class="WHIT">  </span><span class="NAME">req.send</span><span class="PUNC">(</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">dataResponse</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>462</span> </span><span class="WHIT">    </span><span class="KEYW">try</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>463</span> </span><span class="WHIT">      </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">activities_</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">flashAPI.getActivities</span><span class="PUNC">(</span><span class="NAME">dataResponse</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">'a'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>464</span> </span><span class="WHIT">      </span><span class="NAME">flashAPI.swfObj.handleFetchActivities</span><span class="PUNC">(</span><span class="NAME">reqID</span><span class="PUNC">,</span><span class="WHIT"> 
<span class='linenumber'>465</span>           </span><span class="NAME">gadgets.json.stringify</span><span class="PUNC">(</span><span class="NAME">activities_</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>466</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">catch</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">e</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>467</span> </span><span class="WHIT">      </span><span class="NAME">flashAPI.swfObj.handleError</span><span class="PUNC">(</span><span class="NAME">reqID</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">e</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">  </span><span class="WHIT">
<span class='linenumber'>468</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="WHIT">
<span class='linenumber'>469</span> </span><span class="WHIT">  </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>470</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>471</span> 
<span class='linenumber'>472</span> </span><span class="COMM">/**
<span class='linenumber'>473</span>  * Sends out the update request for new activity. 
<span class='linenumber'>474</span>  * @member flashAPI
<span class='linenumber'>475</span>  * 
<span class='linenumber'>476</span>  * @param {string} reqID The request id.
<span class='linenumber'>477</span>  * @param {Object.&lt;string, Object>} params
<span class='linenumber'>478</span>  *        A map of ActivityRequestField's names and values.
<span class='linenumber'>479</span>  * @param {string} priority HIGH | LOW.
<span class='linenumber'>480</span>  */</span><span class="WHIT">
<span class='linenumber'>481</span> </span><span class="NAME">flashAPI.createActivity</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">reqID</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">params</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">priority</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>482</span> </span><span class="WHIT">  </span><span class="NAME">params</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">flashAPI.wrapParams</span><span class="PUNC">(</span><span class="WHIT">
<span class='linenumber'>483</span> </span><span class="WHIT">      </span><span class="NAME">params</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">opensocial.DataRequest.ActivityRequestFields</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>484</span> 
<span class='linenumber'>485</span> </span><span class="WHIT">  </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">activity</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">opensocial.newActivity</span><span class="PUNC">(</span><span class="NAME">params</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>486</span> </span><span class="WHIT">  </span><span class="NAME">opensocial.requestCreateActivity</span><span class="PUNC">(</span><span class="NAME">activity</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">priority</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">responseItem</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>487</span> </span><span class="WHIT">    </span><span class="COMM">// TODO: deal with error</span><span class="WHIT">
<span class='linenumber'>488</span> </span><span class="WHIT">    </span><span class="NAME">flashAPI.swfObj.handleCreateActivity</span><span class="PUNC">(</span><span class="NAME">reqID</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>489</span> </span><span class="WHIT">  </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>490</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>491</span> 
<span class='linenumber'>492</span> 
<span class='linenumber'>493</span> </span><span class="COMM">//--------------------- Basic data structure -----------------------------------</span><span class="WHIT">
<span class='linenumber'>494</span> </span><span class="COMM">/**
<span class='linenumber'>495</span>  * The basic data set structure.
<span class='linenumber'>496</span>  * @member flashAPI
<span class='linenumber'>497</span>  *
<span class='linenumber'>498</span>  * @class
<span class='linenumber'>499</span>  * @constructor
<span class='linenumber'>500</span>  * @param {opensocial.DataResponse} dataResponse 
<span class='linenumber'>501</span>  *        The response object from container.
<span class='linenumber'>502</span>  */</span><span class="WHIT">
<span class='linenumber'>503</span> </span><span class="NAME">flashAPI.BasicData</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">dataResponse</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>504</span> </span><span class="WHIT">  </span><span class="COMM">/** 
<span class='linenumber'>505</span>    * @member flashAPI.BasicData
<span class='linenumber'>506</span>    * @type {flashAPI.Person?}
<span class='linenumber'>507</span>    */</span><span class="WHIT">
<span class='linenumber'>508</span> </span><span class="WHIT">  </span><span class="NAME">this.viewer</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">flashAPI.getPerson</span><span class="PUNC">(</span><span class="NAME">dataResponse</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">'v'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>509</span> </span><span class="WHIT">  </span><span class="COMM">/**
<span class='linenumber'>510</span>    * @member flashAPI.BasicData
<span class='linenumber'>511</span>    * @type {Object.&lt;string, string>?}
<span class='linenumber'>512</span>    */</span><span class="WHIT">
<span class='linenumber'>513</span> </span><span class="WHIT">  </span><span class="NAME">this.viewerData</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">flashAPI.getPersonAppData</span><span class="PUNC">(</span><span class="NAME">dataResponse</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">'vd'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">'VIEWER'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>514</span> </span><span class="WHIT">  </span><span class="COMM">/**
<span class='linenumber'>515</span>    * @member flashAPI.BasicData
<span class='linenumber'>516</span>    * @type {flashAPI.Collection?}
<span class='linenumber'>517</span>    */</span><span class="WHIT">
<span class='linenumber'>518</span> </span><span class="WHIT">  </span><span class="NAME">this.viewerFriends</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">flashAPI.getPeople</span><span class="PUNC">(</span><span class="NAME">dataResponse</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">'vf'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>519</span> </span><span class="WHIT">  </span><span class="COMM">/** 
<span class='linenumber'>520</span>    * @member flashAPI.BasicData
<span class='linenumber'>521</span>    * @type {flashAPI.Person?}
<span class='linenumber'>522</span>    */</span><span class="WHIT"> </span><span class="WHIT">
<span class='linenumber'>523</span> </span><span class="WHIT">  </span><span class="NAME">this.owner</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">flashAPI.getPerson</span><span class="PUNC">(</span><span class="NAME">dataResponse</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">'o'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>524</span> </span><span class="WHIT">  </span><span class="COMM">/**
<span class='linenumber'>525</span>    * @member flashAPI.BasicData
<span class='linenumber'>526</span>    * @type {Object.&lt;string, string>?}
<span class='linenumber'>527</span>    */</span><span class="WHIT">
<span class='linenumber'>528</span> </span><span class="WHIT">  </span><span class="NAME">this.ownerData</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">flashAPI.getPersonAppData</span><span class="PUNC">(</span><span class="NAME">dataResponse</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">'od'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">'OWNER'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>529</span> </span><span class="WHIT">  </span><span class="COMM">/**
<span class='linenumber'>530</span>    * @member flashAPI.BasicData
<span class='linenumber'>531</span>    * @type {flashAPI.Collection?}
<span class='linenumber'>532</span>    */</span><span class="WHIT">
<span class='linenumber'>533</span> </span><span class="WHIT">  </span><span class="NAME">this.ownerFriends</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">flashAPI.getPeople</span><span class="PUNC">(</span><span class="NAME">dataResponse</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">'of'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>534</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>535</span> 
<span class='linenumber'>536</span> 
<span class='linenumber'>537</span> </span><span class="COMM">//--------------------- Kernel type wrappers --------------------------------</span><span class="WHIT">
<span class='linenumber'>538</span> </span><span class="COMM">/**
<span class='linenumber'>539</span>  * The collection class, wrapped from &lt;code>opensocial.Collection&lt;/code>.
<span class='linenumber'>540</span>  * @member flashAPI
<span class='linenumber'>541</span>  * @class 
<span class='linenumber'>542</span>  * @constructor
<span class='linenumber'>543</span>  * @param {opensocial.Collection} collection The original data object.
<span class='linenumber'>544</span>  * @param {Function} flashAPIType 
<span class='linenumber'>545</span>  *        The constuctor of the items in this collection.
<span class='linenumber'>546</span>  */</span><span class="WHIT">
<span class='linenumber'>547</span> </span><span class="NAME">flashAPI.Collection</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">collection</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">flashAPIType</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>548</span>   </span><span class="COMM">/**
<span class='linenumber'>549</span>    * All the objects in this collection.
<span class='linenumber'>550</span>    * @member flashAPI.Collection
<span class='linenumber'>551</span>    * @type {Array}
<span class='linenumber'>552</span>    */</span><span class="WHIT">
<span class='linenumber'>553</span> </span><span class="WHIT">  </span><span class="NAME">this.array</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">[</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>554</span> 
<span class='linenumber'>555</span> </span><span class="WHIT">  </span><span class="COMM">/** 
<span class='linenumber'>556</span>    * The total size of the larger result set that this collection belongs to.
<span class='linenumber'>557</span>    * @member flashAPI.Collection
<span class='linenumber'>558</span>    * @type {number}
<span class='linenumber'>559</span>    */</span><span class="WHIT">
<span class='linenumber'>560</span> </span><span class="WHIT">  </span><span class="NAME">this.totalSize</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>561</span>   
<span class='linenumber'>562</span>   </span><span class="COMM">/**
<span class='linenumber'>563</span>    * The size of this collection, which is equal to or less than the total size 
<span class='linenumber'>564</span>    * of the result.
<span class='linenumber'>565</span>    * @member flashAPI.Collection
<span class='linenumber'>566</span>    * @type {number}
<span class='linenumber'>567</span>    */</span><span class="WHIT">
<span class='linenumber'>568</span> </span><span class="WHIT">  </span><span class="NAME">this.size</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>569</span>   
<span class='linenumber'>570</span>   </span><span class="COMM">/**
<span class='linenumber'>571</span>    * The offset of this collection within a larger result set.
<span class='linenumber'>572</span>    * @member flashAPI.Collection
<span class='linenumber'>573</span>    * @type {number}
<span class='linenumber'>574</span>    */</span><span class="WHIT">
<span class='linenumber'>575</span> </span><span class="WHIT">  </span><span class="NAME">this.offset</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>576</span> 
<span class='linenumber'>577</span>   </span><span class="COMM">// Initialization</span><span class="WHIT">
<span class='linenumber'>578</span> </span><span class="WHIT">  </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">collection</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="KEYW">return</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>579</span> </span><span class="WHIT">  </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">array</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>580</span> </span><span class="WHIT">  </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">collection.asArray</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT"> </span><span class="COMM">// due with real Collection</span><span class="WHIT">
<span class='linenumber'>581</span> </span><span class="WHIT">    </span><span class="NAME">array</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">collection.asArray</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>582</span> </span><span class="WHIT">    </span><span class="NAME">this.offset</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">collection.getOffset</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>583</span> </span><span class="WHIT">    </span><span class="NAME">this.totalSize</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT">  </span><span class="NAME">collection.getTotalSize</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>584</span> </span><span class="WHIT">    </span><span class="NAME">this.size</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">collection.size</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>585</span> </span><span class="WHIT">  </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">flashAPI.isArray</span><span class="PUNC">(</span><span class="NAME">collection</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT"> </span><span class="COMM">// due with array</span><span class="WHIT">
<span class='linenumber'>586</span> </span><span class="WHIT">    </span><span class="NAME">array</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">collection</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>587</span> </span><span class="WHIT">    </span><span class="NAME">this.offset</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>588</span> </span><span class="WHIT">    </span><span class="NAME">this.totalSize</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">collection.length</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>589</span> </span><span class="WHIT">    </span><span class="NAME">this.size</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.totalSize</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>590</span> </span><span class="WHIT">  </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>591</span> </span><span class="WHIT">  </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">array</span><span class="WHIT"> </span><span class="PUNC">!=</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>592</span> </span><span class="WHIT">    </span><span class="KEYW">for</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">index</span><span class="WHIT"> </span><span class="KEYW">in</span><span class="WHIT"> </span><span class="NAME">array</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>593</span> </span><span class="WHIT">      </span><span class="NAME">this.array.push</span><span class="PUNC">(</span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">flashAPIType</span><span class="PUNC">(</span><span class="NAME">array</span><span class="PUNC">[</span><span class="NAME">index</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>594</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>595</span> </span><span class="WHIT">  </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>596</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>597</span> 
<span class='linenumber'>598</span> 
<span class='linenumber'>599</span> </span><span class="COMM">/**
<span class='linenumber'>600</span>  * The person class wrapped from &lt;code>opensocial.Person&lt;/code>.
<span class='linenumber'>601</span>  * @member flashAPI
<span class='linenumber'>602</span>  * @class
<span class='linenumber'>603</span>  * @constructor
<span class='linenumber'>604</span>  * @param {opensocial.Person} person The original data object.
<span class='linenumber'>605</span>  */</span><span class="WHIT">
<span class='linenumber'>606</span> </span><span class="NAME">flashAPI.Person</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">person</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>607</span>   </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">person</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="KEYW">return</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>608</span> 
<span class='linenumber'>609</span> </span><span class="WHIT">  </span><span class="COMM">/**
<span class='linenumber'>610</span>    * True if this person is the OWNER
<span class='linenumber'>611</span>    * @member flashAPI.Person
<span class='linenumber'>612</span>    * @type {boolean}
<span class='linenumber'>613</span>    */</span><span class="WHIT">
<span class='linenumber'>614</span> </span><span class="WHIT">  </span><span class="NAME">this.isOwner</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">person.isOwner</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>615</span> 
<span class='linenumber'>616</span> </span><span class="WHIT">  </span><span class="COMM">/**
<span class='linenumber'>617</span>    * True if this person is the VIEWER
<span class='linenumber'>618</span>    * @member flashAPI.Person
<span class='linenumber'>619</span>    * @type {boolean}
<span class='linenumber'>620</span>    */</span><span class="WHIT">
<span class='linenumber'>621</span> </span><span class="WHIT">  </span><span class="NAME">this.isViewer</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">person.isViewer</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>622</span> 
<span class='linenumber'>623</span> </span><span class="WHIT">  </span><span class="COMM">/**
<span class='linenumber'>624</span>    * The person's meaningful name for displaying.
<span class='linenumber'>625</span>    * @member flashAPI.Person
<span class='linenumber'>626</span>    * @type {string}
<span class='linenumber'>627</span>    */</span><span class="WHIT">
<span class='linenumber'>628</span> </span><span class="WHIT">  </span><span class="NAME">this.displayName</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">person.getDisplayName</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>629</span> 
<span class='linenumber'>630</span> </span><span class="WHIT">  </span><span class="COMM">/**
<span class='linenumber'>631</span>    * The person id.
<span class='linenumber'>632</span>    * @member flashAPI.Person
<span class='linenumber'>633</span>    * @type {string}
<span class='linenumber'>634</span>    */</span><span class="WHIT">
<span class='linenumber'>635</span> </span><span class="WHIT">  </span><span class="NAME">this.id</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">person.getId</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>636</span>   
<span class='linenumber'>637</span>   </span><span class="COMM">/**
<span class='linenumber'>638</span>    * The person's profile fields.
<span class='linenumber'>639</span>    * @member flashAPI.Person
<span class='linenumber'>640</span>    * @type {Object.&lt;string, string|Array|Object>}
<span class='linenumber'>641</span>    */</span><span class="WHIT">
<span class='linenumber'>642</span> </span><span class="WHIT">  </span><span class="NAME">this.fields</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>643</span>   </span><span class="NAME">flashAPI.wrapFields</span><span class="PUNC">(</span><span class="NAME">person</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>644</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>645</span> 
<span class='linenumber'>646</span> 
<span class='linenumber'>647</span> </span><span class="COMM">/**
<span class='linenumber'>648</span>  * The activity class wrapped from &lt;code>opensocial.Activity&lt;/code>.
<span class='linenumber'>649</span>  * TODO: setField not supported.
<span class='linenumber'>650</span>  * @member flashAPI
<span class='linenumber'>651</span>  * @class
<span class='linenumber'>652</span>  * @constructor
<span class='linenumber'>653</span>  * @param {opensocial.Activity} activity The original data object.
<span class='linenumber'>654</span>  *
<span class='linenumber'>655</span>  */</span><span class="WHIT">
<span class='linenumber'>656</span> </span><span class="NAME">flashAPI.Activity</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">activity</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>657</span> </span><span class="WHIT">  </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">activity</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="KEYW">return</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>658</span> 
<span class='linenumber'>659</span> </span><span class="WHIT">  </span><span class="COMM">/**
<span class='linenumber'>660</span>    * The activity id.
<span class='linenumber'>661</span>    * @member flashAPI.Activity
<span class='linenumber'>662</span>    * @type {string}
<span class='linenumber'>663</span>    */</span><span class="WHIT">  </span><span class="WHIT">
<span class='linenumber'>664</span> </span><span class="WHIT">  </span><span class="NAME">this.id</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">activity.getId</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>665</span>   
<span class='linenumber'>666</span>   </span><span class="COMM">/**
<span class='linenumber'>667</span>    * The activity content fields.
<span class='linenumber'>668</span>    * @member flashAPI.Activity
<span class='linenumber'>669</span>    * @type {Object.&lt;string, string|Array|Object>}
<span class='linenumber'>670</span>    */</span><span class="WHIT">
<span class='linenumber'>671</span> </span><span class="WHIT">  </span><span class="NAME">this.fields</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>672</span>   </span><span class="NAME">flashAPI.wrapFields</span><span class="PUNC">(</span><span class="NAME">activity</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>673</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>674</span> 
<span class='linenumber'>675</span> 
<span class='linenumber'>676</span> </span><span class="COMM">/**
<span class='linenumber'>677</span>  * The message class wrapped from &lt;code>opensocial.Message&lt;/code>.
<span class='linenumber'>678</span>  * TODO: setField not supported.
<span class='linenumber'>679</span>  * @member flashAPI
<span class='linenumber'>680</span>  * @class
<span class='linenumber'>681</span>  * @constructor
<span class='linenumber'>682</span>  * @param {opensocial.Message} message The original data object.
<span class='linenumber'>683</span>  *
<span class='linenumber'>684</span>  */</span><span class="WHIT">
<span class='linenumber'>685</span> </span><span class="NAME">flashAPI.Message</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">message</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>686</span> </span><span class="WHIT">  </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">message</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="KEYW">return</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>687</span> 
<span class='linenumber'>688</span> </span><span class="WHIT">  </span><span class="COMM">/**
<span class='linenumber'>689</span>    * The message contents.
<span class='linenumber'>690</span>    * @member flashAPI.Message
<span class='linenumber'>691</span>    * @type {Object.&lt;string, string|Array|Object>}
<span class='linenumber'>692</span>    */</span><span class="WHIT">
<span class='linenumber'>693</span> </span><span class="WHIT">  </span><span class="NAME">this.fields</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>694</span>   </span><span class="NAME">flashAPI.wrapFields</span><span class="PUNC">(</span><span class="NAME">message</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>695</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>696</span> 
<span class='linenumber'>697</span> </span><span class="COMM">/**
<span class='linenumber'>698</span>  * Wrapped class for all other data types in &lt;code>opensocial&lt;/code> namespace.
<span class='linenumber'>699</span>  * @member flashAPI
<span class='linenumber'>700</span>  * @class
<span class='linenumber'>701</span>  * @constructor
<span class='linenumber'>702</span>  * @param {Object?} opt_data
<span class='linenumber'>703</span>  *        The original data object, can be &lt;code>opensocial.Email&lt;/code>, 
<span class='linenumber'>704</span>  *        &lt;code>opensocial.Url&lt;/code>, etc.
<span class='linenumber'>705</span>  */</span><span class="WHIT">
<span class='linenumber'>706</span> </span><span class="NAME">flashAPI.SimpleType</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">opt_data</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>707</span> </span><span class="WHIT">  </span><span class="COMM">/**
<span class='linenumber'>708</span>    * The data fields.
<span class='linenumber'>709</span>    * @member flashAPI.SimpleType
<span class='linenumber'>710</span>    * @type {Object.&lt;string, string|Array|Object>}
<span class='linenumber'>711</span>    */</span><span class="WHIT">
<span class='linenumber'>712</span> </span><span class="WHIT">  </span><span class="NAME">this.fields</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>713</span>   
<span class='linenumber'>714</span>   </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">opt_data</span><span class="WHIT"> </span><span class="PUNC">!=</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>715</span>     </span><span class="NAME">flashAPI.wrapFields</span><span class="PUNC">(</span><span class="NAME">opt_data</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>716</span>   </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>717</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>718</span> 
<span class='linenumber'>719</span> </span><span class="WHIT">
<span class='linenumber'>720</span> </span><span class="COMM">//======================== Internal helper methods =============================</span><span class="WHIT">
<span class='linenumber'>721</span> </span><span class="COMM">// All following functions are only used in this javascript file.</span><span class="WHIT">
<span class='linenumber'>722</span> </span><span class="COMM">// (JSCompiler will rename the names!)</span><span class="WHIT">
<span class='linenumber'>723</span> 
<span class='linenumber'>724</span> </span><span class="COMM">//--------------------- Data response accessors --------------------------------</span><span class="WHIT">
<span class='linenumber'>725</span> </span><span class="COMM">/**
<span class='linenumber'>726</span>  * Gets data object from resoponse.
<span class='linenumber'>727</span>  * @member flashAPI
<span class='linenumber'>728</span>  * @private
<span class='linenumber'>729</span>  * @param {opensocial.DataResponse} dataResponse The response object.
<span class='linenumber'>730</span>  * @param {string} key The data key in the response object.
<span class='linenumber'>731</span>  * @throws {Error} When the RPC meets error.
<span class='linenumber'>732</span>  * @return {Object?} The data, can be any instance of the opensocial data type,
<span class='linenumber'>733</span>  *                   or a collection data type.
<span class='linenumber'>734</span>  */</span><span class="WHIT">
<span class='linenumber'>735</span> </span><span class="NAME">flashAPI.getData</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">dataResponse</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">key</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>736</span> </span><span class="WHIT">  </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">dataResponse</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>737</span> </span><span class="WHIT">  </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">dataResponse.hadError</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>738</span> </span><span class="WHIT">    </span><span class="NAME">console.info</span><span class="PUNC">(</span><span class="STRN">'[ERROR] Data Response Error!'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>739</span> </span><span class="WHIT">  </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>740</span> </span><span class="WHIT">  </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">key</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>741</span> </span><span class="WHIT">  </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">responseItem</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">dataResponse.get</span><span class="PUNC">(</span><span class="NAME">key</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>742</span> </span><span class="WHIT">  </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">responseItem</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>743</span> </span><span class="WHIT">  </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">responseItem.hadError</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>744</span> </span><span class="WHIT">    </span><span class="NAME">console.info</span><span class="PUNC">(</span><span class="STRN">'[ERROR] '</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">responseItem.getErrorCode</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">':'</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="WHIT">
<span class='linenumber'>745</span> </span><span class="WHIT">                    </span><span class="NAME">responseItem.getErrorMessage</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>746</span> </span><span class="WHIT">  </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>747</span> </span><span class="WHIT">  </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">responseItem.getData</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>748</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>749</span> 
<span class='linenumber'>750</span> 
<span class='linenumber'>751</span> </span><span class="COMM">/**
<span class='linenumber'>752</span>  * Gets person from the response.
<span class='linenumber'>753</span>  * @see //flash/actionscript/com/google/ccc/chinasocial/api/Person.as
<span class='linenumber'>754</span>  * @member flashAPI
<span class='linenumber'>755</span>  * @private
<span class='linenumber'>756</span>  * @param {opensocial.DataResponse} dataResponse The response object.
<span class='linenumber'>757</span>  * @param {string} key The data key in the response object.
<span class='linenumber'>758</span>  * @return {flashAPI.Person?} 
<span class='linenumber'>759</span>  *         Wrapped JSON object of an &lt;code>opensocial.Person&lt;/code> object.
<span class='linenumber'>760</span>  */</span><span class="WHIT">
<span class='linenumber'>761</span> </span><span class="NAME">flashAPI.getPerson</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">dataResponse</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">key</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>762</span> </span><span class="WHIT">  </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">data</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">flashAPI.getData</span><span class="PUNC">(</span><span class="NAME">dataResponse</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">key</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>763</span> 
<span class='linenumber'>764</span> </span><span class="WHIT">  </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">key</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="STRN">'v'</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>765</span> </span><span class="WHIT">    </span><span class="NAME">EXPORT</span><span class="PUNC">(</span><span class="STRN">'viewer'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">data</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">  </span><span class="COMM">// for debug</span><span class="WHIT">
<span class='linenumber'>766</span> </span><span class="WHIT">  </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">key</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="STRN">'o'</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>767</span> </span><span class="WHIT">    </span><span class="NAME">EXPORT</span><span class="PUNC">(</span><span class="STRN">'owner'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">data</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">  </span><span class="COMM">// for debug</span><span class="WHIT">
<span class='linenumber'>768</span> </span><span class="WHIT">  </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>769</span> </span><span class="WHIT">  </span><span class="WHIT">
<span class='linenumber'>770</span> </span><span class="WHIT">  </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">data</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>771</span> </span><span class="WHIT">  </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">person_</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">flashAPI.Person</span><span class="PUNC">(</span><span class="NAME">data</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>772</span> </span><span class="WHIT">  </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">person_</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>773</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>774</span> 
<span class='linenumber'>775</span> </span><span class="COMM">/**
<span class='linenumber'>776</span>  * Gets multiple people from the response.
<span class='linenumber'>777</span>  * @see //flash/actionscript/com/google/ccc/chinasocial/api/Person.as
<span class='linenumber'>778</span>  * @see //flash/actionscript/com/google/ccc/chinasocial/api/Collection.as
<span class='linenumber'>779</span>  * @member flashAPI
<span class='linenumber'>780</span>  * @private
<span class='linenumber'>781</span>  * @param {opensocial.DataResponse} dataResponse The response object.
<span class='linenumber'>782</span>  * @param {string} key The data key in the response object.
<span class='linenumber'>783</span>  * @return {flashAPI.Collection?} 
<span class='linenumber'>784</span>  *         Wrapped JSON object of an &lt;code>opensocial.Collection&lt;/code> object.
<span class='linenumber'>785</span>  */</span><span class="WHIT">
<span class='linenumber'>786</span> </span><span class="NAME">flashAPI.getPeople</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">dataResponse</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">key</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>787</span> </span><span class="WHIT">  </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">data</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">flashAPI.getData</span><span class="PUNC">(</span><span class="NAME">dataResponse</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">key</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>788</span> </span><span class="WHIT">  </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">data</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>789</span> </span><span class="WHIT">  </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">people_</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">flashAPI.Collection</span><span class="PUNC">(</span><span class="NAME">data</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">flashAPI.Person</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>790</span> </span><span class="WHIT">  </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">people_</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>791</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>792</span> 
<span class='linenumber'>793</span> </span><span class="COMM">/**
<span class='linenumber'>794</span>  * Gets the user-scope app data from response. The app data is a map with
<span class='linenumber'>795</span>  * the keys are the person ids.
<span class='linenumber'>796</span>  * @member flashAPI
<span class='linenumber'>797</span>  * @private
<span class='linenumber'>798</span>  * @param {opensocial.DataResponse} dataResponse The response object.
<span class='linenumber'>799</span>  * @param {string} key The data key in the response object.
<span class='linenumber'>800</span>  * @param {string?} personId The person Id.
<span class='linenumber'>801</span>  * @return {Object.&lt;string, string>?} 
<span class='linenumber'>802</span>  *         The key-value pairs for the person in this app.
<span class='linenumber'>803</span>  */</span><span class="WHIT">
<span class='linenumber'>804</span> </span><span class="NAME">flashAPI.getPersonAppData</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">dataResponse</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">key</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">personId</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>805</span> </span><span class="WHIT">  </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">data</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">flashAPI.getData</span><span class="PUNC">(</span><span class="NAME">dataResponse</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">key</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>806</span> </span><span class="WHIT">  </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">data</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>807</span> </span><span class="WHIT">  </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">personId</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="STRN">'VIEWER'</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="NAME">personId</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="STRN">'OWNER'</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>808</span> </span><span class="WHIT">    </span><span class="KEYW">for</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">id</span><span class="WHIT"> </span><span class="KEYW">in</span><span class="WHIT"> </span><span class="NAME">data</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>809</span> </span><span class="WHIT">      </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">data</span><span class="PUNC">[</span><span class="NAME">id</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>810</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>811</span> </span><span class="WHIT">  </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">personId</span><span class="WHIT"> </span><span class="PUNC">!=</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>812</span> </span><span class="WHIT">    </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">data</span><span class="PUNC">[</span><span class="NAME">personId</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>813</span> </span><span class="WHIT">  </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>814</span> </span><span class="WHIT">  </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>815</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>816</span> 
<span class='linenumber'>817</span> </span><span class="COMM">/**
<span class='linenumber'>818</span>  * Gets multiple activities from the response.
<span class='linenumber'>819</span>  * @see //flash/actionscript/com/google/ccc/chinasocial/api/Activity.as
<span class='linenumber'>820</span>  * @see //flash/actionscript/com/google/ccc/chinasocial/api/Collection.as
<span class='linenumber'>821</span>  * @member flashAPI
<span class='linenumber'>822</span>  * @private
<span class='linenumber'>823</span>  * @param {opensocial.DataResponse} dataResponse The response object.
<span class='linenumber'>824</span>  * @param {string} key The data key in the response object.
<span class='linenumber'>825</span>  * @return {flashAPI.Collection?}
<span class='linenumber'>826</span>  *         Wrapped JSON object of an &lt;code>opensocial.Collection&lt;/code> object.
<span class='linenumber'>827</span>  */</span><span class="WHIT">
<span class='linenumber'>828</span> </span><span class="NAME">flashAPI.getActivities</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">dataResponse</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">key</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>829</span> </span><span class="WHIT">  </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">data</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">flashAPI.getData</span><span class="PUNC">(</span><span class="NAME">dataResponse</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">key</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>830</span> </span><span class="WHIT">  </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">data</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>831</span> </span><span class="WHIT">  </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">activities_</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">flashAPI.Collection</span><span class="PUNC">(</span><span class="NAME">data</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">flashAPI.Activity</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>832</span> </span><span class="WHIT">  </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">activities_</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>833</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>834</span> 
<span class='linenumber'>835</span> 
<span class='linenumber'>836</span> </span><span class="COMM">//--------------------- Simple type wrappers ---------------------------------</span><span class="WHIT">
<span class='linenumber'>837</span> </span><span class="COMM">/**
<span class='linenumber'>838</span>  * Checks the responded opensocial data structure's type.
<span class='linenumber'>839</span>  * @member flashAPI
<span class='linenumber'>840</span>  * @private
<span class='linenumber'>841</span>  * @param {Object?} dataObj The original opensocial data object.
<span class='linenumber'>842</span>  * @return {Function?} the types' constructor.
<span class='linenumber'>843</span>  */</span><span class="WHIT">
<span class='linenumber'>844</span> </span><span class="NAME">flashAPI.checkType</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">dataObj</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>845</span> </span><span class="WHIT">  </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">type</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>846</span> </span><span class="WHIT">  </span><span class="COMM">// TODO: MediaItem and BodyType are not supported yet.</span><span class="WHIT">
<span class='linenumber'>847</span> </span><span class="WHIT">  </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">opensocial.Address</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">dataObj</span><span class="WHIT"> </span><span class="KEYW">instanceof</span><span class="WHIT"> </span><span class="NAME">opensocial.Address</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>848</span> </span><span class="WHIT">    </span><span class="NAME">type</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">opensocial.Address</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>849</span> </span><span class="WHIT">  </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">opensocial.Email</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">dataObj</span><span class="WHIT"> </span><span class="KEYW">instanceof</span><span class="WHIT"> </span><span class="NAME">opensocial.Email</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>850</span> </span><span class="WHIT">    </span><span class="NAME">type</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">opensocial.Email</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>851</span> </span><span class="WHIT">  </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">opensocial.Name</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">dataObj</span><span class="WHIT"> </span><span class="KEYW">instanceof</span><span class="WHIT"> </span><span class="NAME">opensocial.Name</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>852</span> </span><span class="WHIT">    </span><span class="NAME">type</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">opensocial.Name</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>853</span> </span><span class="WHIT">  </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">opensocial.Organization</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> 
<span class='linenumber'>854</span>              </span><span class="NAME">dataObj</span><span class="WHIT"> </span><span class="KEYW">instanceof</span><span class="WHIT"> </span><span class="NAME">opensocial.Organization</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>855</span> </span><span class="WHIT">    </span><span class="NAME">type</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">opensocial.Organization</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>856</span> </span><span class="WHIT">  </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">opensocial.Phone</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">dataObj</span><span class="WHIT"> </span><span class="KEYW">instanceof</span><span class="WHIT"> </span><span class="NAME">opensocial.Phone</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>857</span> </span><span class="WHIT">    </span><span class="NAME">type</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">opensocial.Phone</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>858</span> </span><span class="WHIT">  </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">opensocial.Url</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">dataObj</span><span class="WHIT"> </span><span class="KEYW">instanceof</span><span class="WHIT"> </span><span class="NAME">opensocial.Url</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>859</span> </span><span class="WHIT">    </span><span class="NAME">type</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">opensocial.Url</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>860</span> </span><span class="WHIT">  </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">opensocial.Person</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">dataObj</span><span class="WHIT"> </span><span class="KEYW">instanceof</span><span class="WHIT"> </span><span class="NAME">opensocial.Person</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>861</span> </span><span class="WHIT">    </span><span class="NAME">type</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">opensocial.Person</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>862</span> </span><span class="WHIT">  </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">opensocial.Activity</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">dataObj</span><span class="WHIT"> </span><span class="KEYW">instanceof</span><span class="WHIT"> </span><span class="NAME">opensocial.Activity</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>863</span> </span><span class="WHIT">    </span><span class="NAME">type</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">opensocial.Activity</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>864</span> </span><span class="WHIT">  </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">opensocial.Message</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">dataObj</span><span class="WHIT"> </span><span class="KEYW">instanceof</span><span class="WHIT"> </span><span class="NAME">opensocial.Message</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>865</span> </span><span class="WHIT">    </span><span class="NAME">type</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">opensocial.Message</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>866</span> </span><span class="WHIT">  </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">opensocial.Enum</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">dataObj</span><span class="WHIT"> </span><span class="KEYW">instanceof</span><span class="WHIT"> </span><span class="NAME">opensocial.Enum</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>867</span> </span><span class="WHIT">    </span><span class="NAME">type</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">opensocial.Enum</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>868</span> </span><span class="WHIT">  </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>869</span> </span><span class="WHIT">  </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">type</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>870</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>871</span> 
<span class='linenumber'>872</span> 
<span class='linenumber'>873</span> </span><span class="COMM">/**
<span class='linenumber'>874</span>  * Wraps the data objects fields to JSON-style objects without any 
<span class='linenumber'>875</span>  * getter/setter functions. Because in actionscript's ExternalInterface cannot 
<span class='linenumber'>876</span>  * use the getFields to get the data correctly.
<span class='linenumber'>877</span>  * @member flashAPI
<span class='linenumber'>878</span>  * @private
<span class='linenumber'>879</span>  * @param {Object?} dataObj The opensocial data, 
<span class='linenumber'>880</span>  *        e.g. &lt;code>opensocial.Email&lt;/code>, &lt;code>opensocial.Person&lt;/code>...
<span class='linenumber'>881</span>  * @param {Object?} opt_this The converted obj for flash.
<span class='linenumber'>882</span>  * @return {Object?} the converted obj for flash.
<span class='linenumber'>883</span>  */</span><span class="WHIT">
<span class='linenumber'>884</span> </span><span class="NAME">flashAPI.wrapFields</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">dataObj</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">opt_this</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>885</span> </span><span class="WHIT">  </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">dataObj</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>886</span> </span><span class="WHIT">  </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">type</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">flashAPI.checkType</span><span class="PUNC">(</span><span class="NAME">dataObj</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>887</span> 
<span class='linenumber'>888</span> </span><span class="WHIT">  </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">type</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>889</span> </span><span class="WHIT">    </span><span class="COMM">// treat it as string</span><span class="WHIT">
<span class='linenumber'>890</span> </span><span class="WHIT">    </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">dataObj</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>891</span> </span><span class="WHIT">  </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">type</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="NAME">opensocial.Enum</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>892</span> </span><span class="WHIT">    </span><span class="COMM">// return enum name</span><span class="WHIT">
<span class='linenumber'>893</span> </span><span class="WHIT">    </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">dataObj.getDisplayValue</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>894</span> </span><span class="WHIT">  </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>895</span> 
<span class='linenumber'>896</span> </span><span class="WHIT">  </span><span class="COMM">// Null parameter for preventing extra recursion.</span><span class="WHIT">
<span class='linenumber'>897</span> </span><span class="WHIT">  </span><span class="NAME">opt_this</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">opt_this</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">flashAPI.SimpleType</span><span class="PUNC">(</span><span class="KEYW">null</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">    
<span class='linenumber'>898</span> </span><span class="WHIT">
<span class='linenumber'>899</span> </span><span class="WHIT">  </span><span class="NAME">opt_this.fields</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">opt_this.fields</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>900</span> 
<span class='linenumber'>901</span>   </span><span class="COMM">// Grabs the fields data from each structures recursively.</span><span class="WHIT">
<span class='linenumber'>902</span> </span><span class="WHIT">  </span><span class="KEYW">for</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">k</span><span class="WHIT"> </span><span class="KEYW">in</span><span class="WHIT"> </span><span class="NAME">type.Field</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>903</span> </span><span class="WHIT">    </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">key</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">type.Field</span><span class="PUNC">[</span><span class="NAME">k</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>904</span> </span><span class="WHIT">    </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">value</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">dataObj.getField</span><span class="PUNC">(</span><span class="NAME">key</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>905</span> </span><span class="WHIT">    </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">value</span><span class="WHIT"> </span><span class="PUNC">!=</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>906</span> </span><span class="WHIT">      </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">flashAPI.isArray</span><span class="PUNC">(</span><span class="NAME">value</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>907</span> </span><span class="WHIT">        </span><span class="NAME">opt_this.fields</span><span class="PUNC">[</span><span class="NAME">k</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">[</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>908</span> </span><span class="WHIT">        </span><span class="NAME">flashAPI.forEach</span><span class="PUNC">(</span><span class="NAME">value</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">item</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>909</span> </span><span class="WHIT">          </span><span class="NAME">opt_this.fields</span><span class="PUNC">[</span><span class="NAME">k</span><span class="PUNC">]</span><span class="PUNC">.</span><span class="NAME">push</span><span class="PUNC">(</span><span class="NAME">flashAPI.wrapFields</span><span class="PUNC">(</span><span class="NAME">item</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>910</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>911</span> </span><span class="WHIT">      </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>912</span> </span><span class="WHIT">        </span><span class="NAME">opt_this.fields</span><span class="PUNC">[</span><span class="NAME">k</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">flashAPI.wrapFields</span><span class="PUNC">(</span><span class="NAME">value</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>913</span> </span><span class="WHIT">      </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>914</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>915</span> </span><span class="WHIT">  </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>916</span> </span><span class="WHIT">
<span class='linenumber'>917</span> </span><span class="WHIT">  </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">opt_this</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>918</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>919</span> 
<span class='linenumber'>920</span> 
<span class='linenumber'>921</span> </span><span class="COMM">/**
<span class='linenumber'>922</span>  * Wraps JOSN-style (raw) params object (from actionscript) keys to opensocial 
<span class='linenumber'>923</span>  * field types.
<span class='linenumber'>924</span>  * TODO: Maybe more field types in the futures. Not neatly imeplemtation here.
<span class='linenumber'>925</span>  * @member flashAPI
<span class='linenumber'>926</span>  * @private
<span class='linenumber'>927</span>  * @param {Object.&lt;string, Object>?} rawParams 
<span class='linenumber'>928</span>  *        The params object from actionscript.
<span class='linenumber'>929</span>  * @param {Function?} type 
<span class='linenumber'>930</span>  *        The field type class constructor.
<span class='linenumber'>931</span>  *        e.g. &lt;code>opensocial.DataRequest.PeopleRequestFields&lt;/code>.
<span class='linenumber'>932</span>  * @return {Object.&lt;Object, Object>?} New params with the correct keys.
<span class='linenumber'>933</span>  */</span><span class="WHIT">
<span class='linenumber'>934</span> </span><span class="NAME">flashAPI.wrapParams</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">rawParams</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">type</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>935</span> </span><span class="WHIT">  </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">type</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="PUNC">!</span><span class="NAME">rawParams</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>936</span> </span><span class="WHIT">  </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">params</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>937</span> </span><span class="WHIT">  </span><span class="KEYW">for</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">strKey</span><span class="WHIT"> </span><span class="KEYW">in</span><span class="WHIT"> </span><span class="NAME">rawParams</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>938</span> </span><span class="WHIT">    </span><span class="KEYW">switch</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">strKey</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>939</span> </span><span class="WHIT">      </span><span class="KEYW">case</span><span class="WHIT"> </span><span class="STRN">'PROFILE_DETAILS'</span><span class="PUNC">:</span><span class="WHIT">
<span class='linenumber'>940</span> </span><span class="WHIT">        </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">fieldNames</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">rawParams</span><span class="PUNC">[</span><span class="NAME">strKey</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>941</span> </span><span class="WHIT">        </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">fieldNames</span><span class="WHIT"> </span><span class="PUNC">!=</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>942</span> </span><span class="WHIT">          </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">fieldArray</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">[</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>943</span> </span><span class="WHIT">          </span><span class="COMM">// Convert string array to request field objects array</span><span class="WHIT">
<span class='linenumber'>944</span> </span><span class="WHIT">          </span><span class="KEYW">for</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">&lt;</span><span class="WHIT"> </span><span class="NAME">fieldNames.length</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="PUNC">++</span><span class="NAME">i</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>945</span> </span><span class="WHIT">            </span><span class="NAME">fieldArray.push</span><span class="PUNC">(</span><span class="NAME">opensocial.Person.Field</span><span class="PUNC">[</span><span class="NAME">fieldNames</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>946</span> </span><span class="WHIT">          </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>947</span> </span><span class="WHIT">          </span><span class="NAME">params</span><span class="PUNC">[</span><span class="NAME">type</span><span class="PUNC">[</span><span class="NAME">strKey</span><span class="PUNC">]</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">fieldArray</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>948</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>949</span> </span><span class="WHIT">        </span><span class="KEYW">break</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>950</span> </span><span class="WHIT">      </span><span class="KEYW">case</span><span class="WHIT"> </span><span class="STRN">'FILTER'</span><span class="PUNC">:</span><span class="WHIT">
<span class='linenumber'>951</span> </span><span class="WHIT">        </span><span class="NAME">params</span><span class="PUNC">[</span><span class="NAME">type</span><span class="PUNC">[</span><span class="NAME">strKey</span><span class="PUNC">]</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> 
<span class='linenumber'>952</span>             </span><span class="NAME">opensocial.DataRequest.FilterType</span><span class="PUNC">[</span><span class="NAME">rawParams</span><span class="PUNC">[</span><span class="NAME">strKey</span><span class="PUNC">]</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>953</span> </span><span class="WHIT">        </span><span class="KEYW">break</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>954</span> </span><span class="WHIT">      </span><span class="KEYW">case</span><span class="WHIT"> </span><span class="STRN">'SORT_ORDER'</span><span class="PUNC">:</span><span class="WHIT">
<span class='linenumber'>955</span> </span><span class="WHIT">        </span><span class="NAME">params</span><span class="PUNC">[</span><span class="NAME">type</span><span class="PUNC">[</span><span class="NAME">strKey</span><span class="PUNC">]</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> 
<span class='linenumber'>956</span>             </span><span class="NAME">opensocial.DataRequest.SortOrder</span><span class="PUNC">[</span><span class="NAME">rawParams</span><span class="PUNC">[</span><span class="NAME">strKey</span><span class="PUNC">]</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>957</span> </span><span class="WHIT">        </span><span class="KEYW">break</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>958</span> </span><span class="WHIT">      </span><span class="KEYW">default</span><span class="PUNC">:</span><span class="WHIT">
<span class='linenumber'>959</span> </span><span class="WHIT">        </span><span class="NAME">params</span><span class="PUNC">[</span><span class="NAME">type</span><span class="PUNC">[</span><span class="NAME">strKey</span><span class="PUNC">]</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">rawParams</span><span class="PUNC">[</span><span class="NAME">strKey</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>960</span> </span><span class="WHIT">        </span><span class="KEYW">break</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>961</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>962</span> </span><span class="WHIT">  </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>963</span> </span><span class="WHIT">  </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">params</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>964</span> </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>965</span> 
<span class='linenumber'>966</span> 
<span class='linenumber'>967</span> </span><span class="COMM">//--------------------- Utilities ----------------------------------------------</span><span class="WHIT">
<span class='linenumber'>968</span> </span><span class="COMM">/**
<span class='linenumber'>969</span>  * Checks if the object is an array.
<span class='linenumber'>970</span>  * @member flashAPI
<span class='linenumber'>971</span>  * @private
<span class='linenumber'>972</span>  * @param {Object} obj object to be check.
<span class='linenumber'>973</span>  * @return {boolean} True if the object is an array.
<span class='linenumber'>974</span>  */</span><span class="WHIT">
<span class='linenumber'>975</span> </span><span class="NAME">flashAPI.isArray</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">obj</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>976</span> </span><span class="WHIT">  </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">obj</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>977</span> </span><span class="WHIT">  </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">Array</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>978</span> </span><span class="WHIT">    </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">obj</span><span class="WHIT"> </span><span class="KEYW">instanceof</span><span class="WHIT"> </span><span class="NAME">Array</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>979</span> </span><span class="WHIT">  </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>980</span> </span><span class="WHIT">    </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">obj</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="STRN">'object'</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="WHIT">
<span class='linenumber'>981</span> </span><span class="WHIT">        </span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">obj.length</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="STRN">'number'</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="WHIT">
<span class='linenumber'>982</span> </span><span class="WHIT">        </span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">obj.splice</span><span class="WHIT"> </span><span class="PUNC">!=</span><span class="WHIT"> </span><span class="STRN">'undefined'</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>983</span> </span><span class="WHIT">      </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>984</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>985</span> </span><span class="WHIT">      </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>986</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>987</span> </span><span class="WHIT">  </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>988</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>989</span> 
<span class='linenumber'>990</span> </span><span class="COMM">/**
<span class='linenumber'>991</span>  * Iterates an array, calls the function for each item.
<span class='linenumber'>992</span>  * @member flashAPI
<span class='linenumber'>993</span>  * @private
<span class='linenumber'>994</span>  * @param {Array} array The array to be iterated.
<span class='linenumber'>995</span>  * @param {Function} f The function to be applied.
<span class='linenumber'>996</span>  * @param {Object} opt_thisObj The this object for the function.
<span class='linenumber'>997</span>  */</span><span class="WHIT">
<span class='linenumber'>998</span> </span><span class="NAME">flashAPI.forEach</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">array</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">f</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">opt_thisObj</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>999</span> </span><span class="WHIT">  </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">l</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">array.length</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1000</span> </span><span class="WHIT">  </span><span class="KEYW">for</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">&lt;</span><span class="WHIT"> </span><span class="NAME">l</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>1001</span> </span><span class="WHIT">    </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">i</span><span class="WHIT"> </span><span class="KEYW">in</span><span class="WHIT"> </span><span class="NAME">array</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>1002</span> </span><span class="WHIT">      </span><span class="NAME">f.call</span><span class="PUNC">(</span><span class="NAME">opt_thisObj</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">array</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">array</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1003</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>1004</span> </span><span class="WHIT">  </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>1005</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1006</span> 
<span class='linenumber'>1007</span> </span><span class="COMM">/**
<span class='linenumber'>1008</span>  * Extracts container domain name from url(Referer). e.g. sandbox.orkut.com
<span class='linenumber'>1009</span>  * @member flashAPI
<span class='linenumber'>1010</span>  * @private
<span class='linenumber'>1011</span>  * @param {string} url The request url.
<span class='linenumber'>1012</span>  * @return {string} The domain.
<span class='linenumber'>1013</span>  */</span><span class="WHIT">
<span class='linenumber'>1014</span> </span><span class="NAME">flashAPI.extractDomain</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">url</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>1015</span> </span><span class="WHIT">  </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">pattern</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="REGX">/(\w+):\/\/([\w.]+)\/(\S*)/</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1016</span> </span><span class="WHIT">  </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">result</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">url.match</span><span class="PUNC">(</span><span class="NAME">pattern</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1017</span> </span><span class="WHIT">  </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">result</span><span class="WHIT"> </span><span class="PUNC">!=</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>1018</span> </span><span class="WHIT">    </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">result</span><span class="PUNC">[</span><span class="NUMB">2</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1019</span> </span><span class="WHIT">  </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>1020</span> </span><span class="WHIT">    </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="STRN">''</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1021</span> </span><span class="WHIT">  </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>1022</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1023</span> 
<span class='linenumber'>1024</span> </span><span class="COMM">/**
<span class='linenumber'>1025</span>  * Deeply clones an object.
<span class='linenumber'>1026</span>  * @member flashAPI
<span class='linenumber'>1027</span>  * @private
<span class='linenumber'>1028</span>  * @param {Object?} obj The original object.
<span class='linenumber'>1029</span>  * @return {Object?} The cloned object.
<span class='linenumber'>1030</span>  */</span><span class="WHIT">
<span class='linenumber'>1031</span> </span><span class="NAME">flashAPI.cloneObject</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">obj</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>1032</span> </span><span class="WHIT">  </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">obj</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1033</span> </span><span class="WHIT">  </span><span class="KEYW">switch</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">obj</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>1034</span> </span><span class="WHIT">    </span><span class="KEYW">case</span><span class="WHIT"> </span><span class="STRN">'function'</span><span class="PUNC">:</span><span class="WHIT">
<span class='linenumber'>1035</span> </span><span class="WHIT">      </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">obj</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1036</span> </span><span class="WHIT">    </span><span class="KEYW">case</span><span class="WHIT"> </span><span class="STRN">'object'</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="WHIT">
<span class='linenumber'>1037</span> </span><span class="WHIT">      </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">newObj</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">obj.constructor</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1038</span> </span><span class="WHIT">      </span><span class="KEYW">for</span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">key</span><span class="WHIT"> </span><span class="KEYW">in</span><span class="WHIT"> </span><span class="NAME">obj</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="NAME">newObj</span><span class="PUNC">[</span><span class="NAME">key</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">flashAPI.cloneObject</span><span class="PUNC">(</span><span class="NAME">obj</span><span class="PUNC">[</span><span class="NAME">key</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1039</span> </span><span class="WHIT">      </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">newObj</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1040</span> </span><span class="WHIT">    </span><span class="KEYW">default</span><span class="PUNC">:</span><span class="WHIT">
<span class='linenumber'>1041</span> </span><span class="WHIT">      </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">obj.valueOf</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1042</span> </span><span class="WHIT">  </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>1043</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1044</span> 
<span class='linenumber'>1045</span> </span><span class="COMM">/**
<span class='linenumber'>1046</span>  * Get the swf object.
<span class='linenumber'>1047</span>  * @member flashAPI
<span class='linenumber'>1048</span>  * @private
<span class='linenumber'>1049</span>  * @param {string?} name The &lt;object>/&lt;embed> tag's id or name
<span class='linenumber'>1050</span>  * @return {HTMLElement} the swf object.
<span class='linenumber'>1051</span>  */</span><span class="WHIT">
<span class='linenumber'>1052</span> </span><span class="NAME">flashAPI.thisFlash</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">name</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>1053</span> </span><span class="WHIT">  </span><span class="NAME">name</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">name</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="NAME">flashAPI.DEFAULT_FLASH_ID</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1054</span> </span><span class="WHIT">  </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">navigator.appName.indexOf</span><span class="PUNC">(</span><span class="STRN">'Microsoft'</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">!=</span><span class="WHIT"> </span><span class="PUNC">-</span><span class="NUMB">1</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>1055</span> </span><span class="WHIT">    </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">document</span><span class="PUNC">[</span><span class="NAME">name</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1056</span> </span><span class="WHIT">  </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>1057</span> </span><span class="WHIT">    </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">document.getElementById</span><span class="PUNC">(</span><span class="NAME">name</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1058</span> </span><span class="WHIT">  </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>1059</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1060</span> 
<span class='linenumber'>1061</span> </span><span class="COMM">/**
<span class='linenumber'>1062</span>  * For debugging, return the object's keys and values.
<span class='linenumber'>1063</span>  * @member flashAPI
<span class='linenumber'>1064</span>  * @private
<span class='linenumber'>1065</span>  * @param {Object?} obj Any object to be looked into.
<span class='linenumber'>1066</span>  * @param {string?} opt_prefix The prefix string of each output line.
<span class='linenumber'>1067</span>  * @param {string?} opt_rendered The rendered string passing between recursions.
<span class='linenumber'>1068</span>  * @return {string?} A tree-style string to represent the object.
<span class='linenumber'>1069</span>  */</span><span class="WHIT">
<span class='linenumber'>1070</span> </span><span class="NAME">flashAPI.debugInspect</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">obj</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">opt_prefix</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">opt_rendered</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>1071</span> </span><span class="WHIT">  </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">opt_rendered</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="NAME">opt_rendered</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">'\n'</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1072</span> </span><span class="WHIT">  </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">opt_prefix</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="NAME">opt_prefix</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">''</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1073</span> </span><span class="WHIT">  </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">obj</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">opt_rendered</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="STRN">""</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1074</span> </span><span class="WHIT">  </span><span class="KEYW">for</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">k</span><span class="WHIT"> </span><span class="KEYW">in</span><span class="WHIT"> </span><span class="NAME">obj</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>1075</span> </span><span class="WHIT">    </span><span class="NAME">opt_rendered</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="PUNC">=</span><span class="WHIT"> </span><span class="WHIT">
<span class='linenumber'>1076</span> </span><span class="WHIT">        </span><span class="PUNC">(</span><span class="NAME">opt_prefix</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">k</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">'['</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">obj</span><span class="PUNC">[</span><span class="NAME">k</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">'] : '</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">obj</span><span class="PUNC">[</span><span class="NAME">k</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">'\n'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1077</span> </span><span class="WHIT">    </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">obj</span><span class="PUNC">[</span><span class="NAME">k</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="STRN">'object'</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>1078</span> </span><span class="WHIT">      </span><span class="NAME">opt_rendered</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="WHIT">
<span class='linenumber'>1079</span> </span><span class="WHIT">          </span><span class="NAME">flashAPI.debugInspect</span><span class="PUNC">(</span><span class="NAME">obj</span><span class="PUNC">[</span><span class="NAME">k</span><span class="PUNC">]</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">opt_prefix</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">'\t'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">opt_rendered</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1080</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>1081</span> </span><span class="WHIT">  </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>1082</span> </span><span class="WHIT">  </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">opt_rendered</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="STRN">""</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1083</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1084</span> 
<span class='linenumber'>1085</span> 
<span class='linenumber'>1086</span> </span><span class="COMM">/**
<span class='linenumber'>1087</span>  * For debugging, export the local variables to global.
<span class='linenumber'>1088</span>  * Only available when DEBUG = true.
<span class='linenumber'>1089</span>  * @member flashAPI
<span class='linenumber'>1090</span>  * @private
<span class='linenumber'>1091</span>  * @param {string} name The name.
<span class='linenumber'>1092</span>  * @param {Object?} value The value.
<span class='linenumber'>1093</span>  */</span><span class="WHIT">
<span class='linenumber'>1094</span> </span><span class="NAME">flashAPI.debugExport</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">name</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">value</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>1095</span> </span><span class="WHIT">  </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">DEBUG</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>1096</span> </span><span class="WHIT">    </span><span class="NAME">window</span><span class="PUNC">[</span><span class="STRN">'debug'</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">window</span><span class="PUNC">[</span><span class="STRN">'debug'</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1097</span> </span><span class="WHIT">    </span><span class="NAME">window</span><span class="PUNC">[</span><span class="STRN">'debug'</span><span class="PUNC">]</span><span class="PUNC">[</span><span class="NAME">name</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">value</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1098</span> </span><span class="WHIT">  </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>1099</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1100</span> 
<span class='linenumber'>1101</span> </span><span class="COMM">/**
<span class='linenumber'>1102</span>  * For debugging, output text information to firebug console.
<span class='linenumber'>1103</span>  * Only available when DEBUG = true.
<span class='linenumber'>1104</span>  * @member flashAPI
<span class='linenumber'>1105</span>  * @private
<span class='linenumber'>1106</span>  * @param {Object?} content The content to be logged.
<span class='linenumber'>1107</span>  */</span><span class="WHIT">
<span class='linenumber'>1108</span> </span><span class="NAME">flashAPI.debugInfo</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">content</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>1109</span>   </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">DEBUG</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>1110</span>     </span><span class="NAME">console.info</span><span class="PUNC">(</span><span class="NAME">content</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1111</span>   </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>1112</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1113</span> 
<span class='linenumber'>1114</span> </span><span class="COMM">// Export these debugging functions for shortcuts</span><span class="WHIT">
<span class='linenumber'>1115</span> </span><span class="NAME">window</span><span class="PUNC">[</span><span class="STRN">"INFO"</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">flashAPI.debugInfo</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1116</span> </span><span class="NAME">window</span><span class="PUNC">[</span><span class="STRN">"INSPECT"</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">flashAPI.debugInspect</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1117</span> </span><span class="NAME">window</span><span class="PUNC">[</span><span class="STRN">"EXPORT"</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">flashAPI.debugExport</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1118</span> 
<span class='linenumber'>1119</span> </span></pre></body></html>